<template>
	<view class="content">
		<image class="top-bg" :src="imageUrl+'/company_auth/detail_bg.png'"></image>
		<view class="block user-block">
			<image :src="info.comImg?info.comImg:infimageUrl+'/job_hunting/home/Mr.png'" class="user-photo"></image>
			<view @click="navigate('/page_other/company/company?id='+info.comId)" class="info-block">
				<view class="name">{{info.realName}}</view>
				<view class="position">{{info.comPosition}} · 3小时前在线</view>
				<view class="company">认证公司：{{info.enterpriseName}}
					<view class="arrow iconfont icon-gengduo1"></view>
				</view>
			</view>
		</view>
		<view class="block position-block">
			<view class="title-block">
				<view class="title">在招职位 · {{info.count}}</view>
				<view class="line"></view>
			</view>
			<view class="clear"></view>
			<view class="list-block">
				<view @click="navigate('/page_other/job_hunting/job_detail/index?id='+item.id)" class="list-item"
					v-for="(item,index) in info.jobPublishModelList" :key="item.id">
					<view class="info-block">
						<view class="name">{{item.jobTitle}}</view>
						<view class="other">酒泉-阿克塞 | {{item.expRequireText}} | {{item.minEducationText}}</view>
					</view>
					<view class="wage-block" v-if="item.minSalary">{{item.minSalary}}-{{item.maxSalary}}元</view>
					<view class="wage" v-else>面议</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getComRecruitersDetailApi
	} from '@/api/company.js'
	export default {
		data() {
			return {
				id: null,
				imageUrl: '',
				info: {
					realName: '',
					comPosition: '',
					enterpriseName: '',
					count: ''
				}
			}
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			getComRecruitersDetail() {
				uni.showLoading({
					title: '加载中'
				})
				getComRecruitersDetailApi({
					id: this.id,
					page: 1,
					limit: 10
				}).then((res) => {
					this.info = res
				}).catch(() => {
					this.showToast('加载失败', () => {
						uni.navigateBack()
					});
				})
			}
		},
		onLoad(e) {
			this.imageUrl = this.globalConfig.imageUrl;
			this.id = e.id;
			this.getComRecruitersDetail()
		},
		onReady() {
			uni.setNavigationBarColor({
				backgroundColor: '#9cd1f1',
				frontColor: '#ffffff',
			})

		}
	}
</script>

<style lang="scss">
	page {
		background: #F4F4F4;
	}

	.content {
		width: 100%;

		.top-bg {
			width: 100%;
			height: 300rpx;
			z-index: 0;
		}

		.block {
			width: calc(100% - 60rpx);
			border-radius: 20rpx;
			padding: 30rpx;
			background: #fff;
			margin: 0 30rpx;
			margin-bottom: 30rpx;
			position: relative;
		}

		.block.user-block {
			background: none;
			display: flex;
			flex-direction: row;
			margin-top: -300rpx;
			margin-bottom: 0;

			.user-photo {
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
				flex-grow: 0;
			}

			.info-block {
				margin-left: 20rpx;
				flex-grow: 1;
				display: flex;
				flex-direction: column;
				justify-content: center;
				color: #fff;

				.name {
					font-size: 46rpx;
				}

				.position,
				.company {
					font-size: 28rpx;
					margin-top: 10rpx;
				}

				.company {
					display: flex;
					flex-direction: row;
					align-items: center;

					.arrow {
						font-size: 24rpx;
						margin-left: 10rpx;
					}
				}
			}
		}

		.block.position-block {
			.title-block {
				position: relative;
				float: left;

				.title {
					font-size: 40rpx;
					font-weight: bold;
					margin-bottom: 20rpx;
				}

				.line {
					width: 60rpx;
					height: 4px;
					background: #FF7626;
					border-radius: 40rpx;
					position: absolute;
					bottom: 0;
					left: 50%;
					transform: translate(-50%, -50%);
				}

				margin-bottom: 30rpx;
			}

			.list-block {
				width: 100%;
				display: flex;
				flex-direction: column;

				.list-item {
					width: 100%;
					border-bottom: 1px solid #efefef;
					padding: 30rpx 0;
					display: flex;
					flex-direction: row;

					.info-block {
						flex-grow: 1;
						display: flex;
						flex-direction: column;

						.name {
							font-size: 34rpx;
							font-weight: bold;
						}

						.other {
							font-size: 26rpx;
							color: #999;
							margin-top: 20rpx;
						}
					}

					.wage-block {
						width: 260rpx;
						font-weight: bold;
						color: #FF7626;
						display: flex;
						justify-content: right;
					}
				}

				.list-item:first-child {
					border-top: 1px solid #efefef;
				}
			}

		}
	}

	.clear {
		clear: both;
	}
</style>